#include <my_header.h>

int main(int argc,char *argv[])
{
    MYSQL* mysql=mysql_init(NULL);
    MYSQL *ret=mysql_real_connect(mysql,"localhost","admin","123654","test0",0,NULL,0);
    if(ret==NULL){
        printf("ERRO: %s\n",mysql_error(mysql));
        return -1;
    }
    char *sql="select * from Student;";
    int qret=mysql_query(mysql,sql);
    if(qret!=0){
        printf("ERRO: %s\n",mysql_error(mysql));
        return -1;
    }
    MYSQL_RES *res=mysql_store_result(mysql);
    printf("total cols: %u, total rows: %lu\n",mysql_num_fields(res),mysql_num_rows(res));
    for(int i=0;i<mysql_num_rows(res);i++){
        MYSQL_ROW row=mysql_fetch_row(res);
        for(int j=0;j<mysql_num_fields(res);j++){
            printf("%s\t",row[j]);
        }
        printf("\n");
    }
    mysql_close(mysql);
    return 0;
}
